import 'package:distribution_mall_flutter/entity/address/address_entity.dart';
import 'package:distribution_mall_flutter/generated/json/address_state.g.dart';
import 'package:distribution_mall_flutter/generated/json/base/json_field.dart';
export 'package:distribution_mall_flutter/generated/json/base/json_field.dart';

@JsonSerializable()
class AddressState {
  ///用户的地址列表
  List<AddressItem> addressList = [];

  //原注释(姓名手机  地址  配送时长),后续应该改成一个模型类
  ///用户的选择的地址
  SelectAddressItem? userSelectAddress;
  List<AddressDeliveryTimeEntity> addrDeTime = [];

  AddressState();

  factory AddressState.fromJson(Map<String, dynamic> json) =>
      $AddressStateFromJson(json);

  Map<String, dynamic> toJson() => $AddressStateToJson(this);
}

@JsonSerializable()
class SelectAddressItem {
  late AddressItem item;
  late String recipientName;
  late String phone;
  late String address;
  late String virtualPostcode;

  SelectAddressItem();

  factory SelectAddressItem.fromJson(Map<String, dynamic> json) =>
      $SelectAddressItemFromJson(json);

  Map<String, dynamic> toJson() => $SelectAddressItemToJson(this);

  @override
  String toString() {
    return 'SelectAddressItem{item: $item, recipientName: $recipientName, phone: $phone, address: $address, virtualPostcode: $virtualPostcode}';
  }
}
